package com.hllxd.hism.star.basic.service.service;

import com.alibaba.fastjson.JSON;
import com.hllxd.hism.star.basic.service.dao.mapper.mis.SyslogLogMapper;
import com.hllxd.hism.star.basic.service.model.SyslogEntity;
import com.hllxd.hism.star.basic.service.model.SyslogSummaryEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiyong.lxy
 * @date 2020-10-12 16:51
 * v1/user/userInfo.do
 */
@Slf4j
@Service("syslogLogService")
public class SyslogLogServiceImpl implements SyslogLogService {

    @Autowired
    private SyslogLogMapper syslogLogMapper;


    @Override
    public Long setSyslogEntity(String its) {
        List<SyslogEntity> datas = JSON.parseArray(its, SyslogEntity.class);
        for(SyslogEntity data: datas) {
//            log.info("item: {}.", JSON.toJSONString(data));
            syslogLogMapper.insertSyslogEntity(data);
        }
        return 1L;
    }

    @Override
    public List<SyslogEntity> listSyslogEntity() {
        return syslogLogMapper.listSyslogEntity();
    }

    @Override
    public List<SyslogSummaryEntity> listSyslogSummary() {
        return syslogLogMapper.listSyslogSummary();
    }

    @Override
    public List<SyslogSummaryEntity> listSyslogUser() {
        return syslogLogMapper.listSyslogUser();
    }

    @Override
    public List<SyslogSummaryEntity> listSyslogSummaryByUser() {
        return syslogLogMapper.listSyslogSummaryByUser();
    }

}
